# 作者: 家里蹲 吴越洋
# 2023年03月08日15时50分04秒
from socket import *
import struct

server_socket=socket(AF_INET,SOCK_STREAM)
server_socket.bind(('',3000))
server_socket.listen(10)
client_socket,client_addr=server_socket.accept()
print(client_addr)

# 发文件名
file_name='file'
b_file_name=file_name.encode('utf8')
# 发火车头
client_socket.send(struct.pack('I',len(b_file_name)))
# 发名字
client_socket.send(b_file_name)

# 发内容

file=open('file','rb+')
file_text=file.read()
#发火车头
client_socket.send(struct.pack('I',len(file_text)))
client_socket.send(file_text)
file.close()

client_socket.close()
server_socket.close()